package com.example.moneybook.controller;

import com.example.moneybook.dto.ResponseResult;
import com.example.moneybook.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @Author: 包
 * @Date: 2023/3/15 22:35
 * Description:
 */
@RestController
@RequestMapping()
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/login")
    public ResponseResult login(String code){
        return userService.login(code);
    }

    @RequestMapping("/updateInfo")
    public ResponseResult updateInfo(MultipartFile filePath, String userId) throws IOException {
        return userService.updateInfo(filePath, userId);
    }

    @RequestMapping("/updateName")
    public ResponseResult updateName(String userId, String userName){
        return userService.updateName(userId, userName);
    }
}
